<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><{:C('site_name')}></title>
<meta name="keywords" content="<{:C('keyword')}>" />
<meta name="description" content="<{:C('content')}>" />
<link rel="stylesheet" href="<{:STATICS}>/css/bootstrap.min.css" type="text/css" media="all" />
<link rel="stylesheet" href="<{:STATICS}>/css/jquery-ui.min.css" type="text/css" media="all" />
<link rel="stylesheet" href="<{:RES}>/css/style.css" type="text/css" media="all" />
</head>
<script type="text/javascript" src="<{:STATICS}>/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery.artDialog.js?skin=aero"></script>
<script type="text/javascript" src="<{:STATICS}>/js/iframeTools.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery.form.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="<{:STATICS}>/js/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
	//ajaxform
	var options = { 
		beforeSubmit:showRequest,//表单验证方式
        success:showResponse  // post-submit callback 
    }; 

    $('#ajaxForm').ajaxForm(options); 
    var btnStr = $("#myBtn").html();
    function showResponse(responseText, statusText)  {
		if (statusText == 'success') {
			var responseText=eval('('+responseText+')');
			if(responseText.state == 'SUCCESS'){
				alert(responseText.message);
				closeIframe();
			}else{
				alert(responseText.state);
				$("#myBtn").removeAttr('disabled').html(btnStr);
			}			
		}else{
			$("#myBtn").removeAttr('disabled').html(btnStr);
		 	alert('Lost Service');	
		}
	} 

	function showRequest(){
		 validata = $("form.form-validata").valid();
		 if (validata){
		 	$("#myBtn").attr('disabled','disabled').html('<i class="fa fa-spinner fa-spin"></i> waiting...');
		 }
		 return validata;
	}

	//validation验证
	$("form.form-validata").validate({
		errorElement: "span",
        errorClass: "help-block error",
	})

});
</script> 

<script type="text/javascript">
var domid=art.dialog.data('domid');
// 返回数据到主页面
function closeIframe(url){
	var origin = artDialog.open.origin;
	origin.location.reload() ;
	setTimeout("art.dialog.close()", 100 )
}
</script>
<body>
<div class="container iframe">
	<div class="row">
		<div class="col-md-12">
			<form id="ajaxForm" action="<{:U('Plan/updatenode')}>" method="post" class="form-horizontal form-validata">
				<div class="form-group">
					<label>Title</label>
					<input type="text" class="form-control" id="title" name="title" value="<{$list['title']}>" placeholder="Enter title" data-rule-required="true">
				</div>	

				<div class="form-group">
					<label>Start time</label>								
					<div class="input-group">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" class="form-control" id="startTime" name="startTime" value="<{$list['startTime']|date="m/d/Y",###}>" placeholder="Enter start time" data-rule-required="true">
					</div>
				</div>

				<div class="form-group">
					<label>End time</label>
					<div class="input-group">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" class="form-control" id="endTime" name="endTime" value="<{$list['endTime']|date="m/d/Y",###}>" placeholder="Enter end time" data-rule-required="true">
					</div>								
				</div>		

				<script> 
				$(function(){
					$("#startTime" ).datepicker({
									minDate: new Date()
								});
					$("#endTime" ).datepicker({
									minDate: new Date()
								});
				});
				</script>

				<div class="form-group">
					<label for="exampleTextarea">Descriptions</label>
					<textarea class="form-control" name="content" id="content" rows="5" data-rule-required="true"><{$list['content']}></textarea>
				</div>	

				<div class="form-group">				
					<button type="submit" id="myBtn" class="btn btn-success"><{:L('_public_edit')}></button>	
				</div>
				<input type="hidden" name="id" value="<{$list['id']}>">
			</form>
		</div>
	</div>
</div>
</body>
</html>
